import request from '@/utils/request'
import axios from 'axios'
const URL = 'admin'

export function login(username, password) {
  return request({
    url: URL + '/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getInfo(token, username) {
    return request({
    url: URL + '/info',
    method: 'post',
    data: {
      token,
      username
    }
  })
}

export function getByUserName(val) {
  // return axios.post( 'http://localhost:8080/ho-api/'+URL + '/info', {
  //   username: val
  // })
  // return request({
  //   method: 'post',
  //   url: URL + '/info',
  //   data: {
  //     username: val
  //   }
  // })
  return request({
    url: URL + '/'+val,
    method: 'post',
    data: {
    }
  })

}
export function getByUsername(val) {
  return request({
    method: 'post',
    url: URL + '/info',
    data: {
      username: val
    }
  })
}
export function logout() {
  return request({
    url: URL + '/logout',
    method: 'post'
  })
}
